package org.jackysoft.interceptor;

import java.io.File;
import java.lang.reflect.Method;

import com.opensymphony.xwork2.ActionInvocation;

public class UploadsInterceptor extends AbstractInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 936181417705601881L;	

	@Override
	public String intercept(ActionInvocation ai) throws Exception {
		super.intercept(ai);
		Object action = ai.getAction();
		File[]   file = (File[]) parseBean(action, "upLoads");
		String[] name = (String[]) parseBean(action, "upLoadsFileName");
	
		Method service_m_gets = service.getClass().getMethod("create", File[].class, String[].class);
		// 保存对象
		service_m_gets.invoke(service, file, name);
        		
		return ai.invoke();
	}
}
